/****************************************Copyright (c)**************************************************
**                                         2016-03
**
**                                
**
**
**--------------File Info-------------------------------------------------------------------------------
** File name:		    ht6x1x_wdt.h
** Last modified Date:  2016-03-29
** Last Version:		v1.0
** Descriptions:		
**
**------------------------------------------------------------------------------------------------------
** Created by:			Evan Chen
** Created date:		2016-03-29
** Version:				v1.0
** Descriptions:		
**
**------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
** Version:
** Descriptions:
**
********************************************************************************************************/

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __HT6X1X_WDT_H
#define __HT6X1X_WDT_H

#ifdef __cplusplus
 extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "ht60xx.h"

/*WDTCFG*/
#define WDTCFG_INT_RST_MASK	((uint16_t)0x0001)
#define WDTCFG_RESET    		((uint16_t)0x0000)
#define WDTCFG_INTERRUP     	((uint16_t)0x0001)

typedef enum
{
  	WDT_Mode_Reset = WDTCFG_RESET,
	WDT_Mode_Interrupt = WDTCFG_INTERRUP,
} WDT_Mode_TypeDef;

/*WDTCLR*/
#define WDTCLR_CLR_FLAG 		((uint16_t)0xAA40)/*4160ms*/		
#define WDTCLR_CLR_MASK		((uint16_t)0xFF00)
#define WDTCLR_SET_MASK		((uint16_t)0x00FF)/*64ms * (1+SET[7:0])*/

/*WDTCNT*/
#define WDTCNT_CNT_MASK		((uint16_t)0xFFFF)

void WDT_EnableMode(WDT_Mode_TypeDef mode);
void WDT_SetPrescaler(uint16_t prescaler);
void WDT_SetLoad(uint8_t load);
void WDT_Feed(void);

#ifdef __cplusplus
}
#endif

#endif /* __HT6X1X_WDT_H */

